<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateWechatUsersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('wechat_users', function (Blueprint $table) {
            $table->increments('id');
            $table->unsignedInteger('user_id')->comment('用户 ID');
            $table->string('openid')->comment('openid');
            $table->string('nickname')->comment('微信昵称');
            $table->unsignedTinyInteger('sex')->comment('性别');
            $table->string('language')->comment('语言');
            $table->string('city')->comment('城市');
            $table->string('province')->comment('省份');
            $table->string('country')->comment('国家');
            $table->string('avatar')->comment('头像');

            $table->unique('openid');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('wechat_users');
    }
}
